<?php
// TODO написать этот класс
class Mail {
	private $_mail_boundary; 
	private $_x_mailer = "PHPMail Tool";
	private $_from;
	private $_subject;
	private $_text;
	private $_replayTo;
	
	function __construct($from){
		$this->_mail_boundary = strtoupper(uniqid(time()));
		
		$this->_from = $from;
	}
	
	public function setReplayTo($e_mail_address){
		$this->_replayTo = $e_mail_address;
	}
	
	public function setBody($subject, $text){
		$this->_subject = $subject;
		$this->_text = $text;
	}
	
	private function _getContent(){
		
	}
	
	public function send($e_mail_address){
		return @mail($e_mail_address, $this->_subject, $this->_getContent(), $this->_getHeader());
	}
	
	private function _getHeader(){
		$head  = "From: $this->_from\n";
		$head .= "Subject: $this->_subject\n";
		$head .= "X-Mailer: $this->_x_mailer\n";
		if (isset($this->_replayTo) && strlen($this->_replayTo)>3)
			$head  .= "Reply-To: $this->_replayTo\n";
		$head .= "Mime-Version: 1.0\n";
		$head .= "Content-Type:multipart/mixed;";
		$head .= "boundary=\"----------$this->_mail_boundary\"\n\n";
		$head .= "X-Priority: 3\n";
		return $head;
	}
}
?>